<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script src="/js/jquery-1.8.3.min.js"></script>
<body>
<form method="post" action="/book/dels">


<input value="删除" type="submit">
<table>
    <tr>
        <th>选择</th>
        <th>编号</th>
        <th>书名</th>
        <th>价格</th>
        <th>类目</th>
        <th>库存</th>
        <th>图片</th>
        <th>说明</th>
        <th>作者</th>
        <th>已售</th>
    </tr>

    <tr th:each="book : ${page.list}">
        <td>
            <input type="checkbox" name="ids" th:value="${book.id}">
        </td>
        <td th:text="${book.id}">编号</td>
        <td th:text="${book.name}">书名</td>
        <td th:text="${book.price}">价格</td>
        <td th:text="${book.category}">类目</td>
        <td th:text="${book.pnum}">库存</td>
        <td th:text="${book.imgurl}">图片</td>
        <td th:text="${book.description}">说明</td>
        <td th:text="${book.author}">作者</td>
        <td th:text="${book.sales}">已售</td>
    </tr>
</table>
    总的页数：<span th:text="${page.pages}"></span>
    总的记录数：<span th:text="${page.total}"></span>
    当前页的记录数：<span th:text="${page.size}"></span>
    当前页：<span th:text="${page.pageNum}"></span>


    <span th:if="${page.hasPreviousPage}">
        <a th:href="@{/book/getPage(pageNum=${page.pageNum -1})}">上一页</a>
    </span>


    <span th:each="p : ${#numbers.sequence(1,page.pages)}">
        <a th:href="@{/book/getPage(pageNum=${p})}" th:text="${p}">上一页</a>
    </span>


    <span th:if="${page.hasNextPage}">
        <a th:href="@{/book/getPage(pageNum=${page.pageNum +1})}">下一页</a>
    </span>
</form>
<script>
    $("form").submit(function (){
        if ($("input[name='ids']:checked").length<=0){
            alert("至少选择一项进行删除")
            return false;
        }
    })
</script>
</body>
</html>